/*
 * Created on May 5, 2004
 *
 * Vectrics Inc.  GNU Public License.
 */
package org.vectrics.common.db;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import org.vectrics.SystemException;
import org.vectrics.domain.Domain;

/**
 * @author mmoore
 */
public class Criteria implements Serializable {
	public static final long serialVersionUID = 2350750931399L;

	public static final short VOID_ALL = 0;
	public static final short VOID_YES = 1;
	public static final short VOID_NO = 2;
	
	private short voidedType = VOID_NO;
	private Set domains = new HashSet();
	
	public Criteria() {
		super();
		this.setVoidedType(Criteria.VOID_NO);
	}

	public short getVoidedType() {
		return voidedType;
	}

	public void setVoidedType(short voidedType) {
		this.voidedType = voidedType;
	}
	
	public Set getDomains() {
		return(this.domains);
	}
	
	public void addDomain(Domain domain) {
		if (domain == null)
			throw new SystemException("Cannot add a null domain to the criteria");
		this.domains.add(domain);
	}
	
	public void setDomains(Collection domains) {
		this.domains = new HashSet();
		this.domains.addAll(domains);
	}
	
}
